﻿@typeparam IData
<table>
    <thead>
        @Header
    </thead>
    <tbody>
        @foreach (var I in Items)
        {
            <tr>@Row(I)</tr>
        }
    </tbody>

</table>
@if (Pagedisplay)
{
   <Page onChange="onChange" PageChanged="PageChanged" PageNumber="PageNumber" PagesSize="PagesSize" PagesCount="PagesCount" /> 
}



@code {
    [Parameter]
    public bool Pagedisplay { get; set; } = true;
    [Parameter]
    public int PagesCount { get; set; }
    [Parameter]
    public int PagesSize { get; set; }
    [Parameter]
    public int PageNumber { get; set; }
    public int TotalPages => (int)Math.Ceiling((double)PagesCount / PagesSize);
    public List<int> list { get; set; } = new List<int>()
    {10,20,30,40,50,60,80,90,100};
    [Parameter]
    public RenderFragment Header { get; set; }
    [Parameter]
    public RenderFragment<IData> Row { get; set; }
    [Parameter]
    public EventCallback<ChangeEventArgs> onChange { get; set; }
    [Parameter]
    public IReadOnlyList<IData> Items { get; set; }

    [Parameter]
    public EventCallback<int> PageChanged { get; set; }
}
